package Properties;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
//猜拳,三次  超过三次提示请充值
public class ProperitesGame {
    public static void main(String[] args) throws IOException {
        //从文件中读取数据到Properites集合  用load()实现
        Properties prop = new Properties();
        FileReader fr =new FileReader("D:\\Idea\\Properties\\game.txt");
        prop.load(fr);
        fr.close();
        String count = prop.getProperty("count");
        int num = Integer.parseInt(count);
        //判断是否有三次
        if(num>=3){
            System.out.println("游戏已经结束,继续玩请充值");
        }else {
            GuessNumber.start();
            num++;
            prop.setProperty("count",String.valueOf(num));
            FileWriter fw = new FileWriter("D:\\Idea\\Properties\\game.txt");
            prop.store(fw,null);
            fw.close();
        }
    }
}
